<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{$naire.name}-{$parent}</title>
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css" media="all">
    <style>
    </style>
</head>
<body>
<table class="table2excel layui-table" border="1"  data-name="{$naire.name}-{$parent}-{$children}" >
    <colgroup>
        <col width="150">
        <col>
    </colgroup>
    <thead>
        <tr>
            <th style="text-align: center;" colspan="{:count($base,COUNT_RECURSIVE)}">{$naire.name}-{$parent}-{$children}</th>
        </tr>
        <tr>
            <th></th>
            <th rowspan="2">综合得分</th>
            <?php $llll=[];?>
            {foreach :end($total) as $k=>$_}
                <?php list($tm,$_)=explode(',',$k);?>
                <th rowspan="2">{$tm}</th>
                <?php $llll[]=$k;?>
            {/foreach}
            <?php $i=0;?>
            {foreach $base as $t}
            <?php
               $i++;
                $count=count($llll);
            ;?>
            <th style="text-align: center;" colspan="{$count}">{$i}</th>
            {/foreach}
        </tr>
        <tr>
            <th></th>
        {foreach $base as $t}
        {foreach $t.answer as $key=>$value}
            {foreach $value as $k=>$v}
            <?php list($key,$value)=explode(',',$k);?>
                <th style="text-align: center;">{$key}</th>
            {/foreach}
            <?php break;?>
        {/foreach}
        {/foreach}
        </tr>
    </thead>
    <tbody>
        {foreach $eart as $mk=>$g}
            <tr>
                <td>
                   {$mk}
                </td>
                <td>
                    <?php $tmp_total=0;?>
                    <?php foreach($llll as $key):?>
                        <?php list($_,$value)=explode(',',$key);$tmp_total+=$total[$mk][$key]*$value;?>
                    <?php endforeach;?>
                    {$tmp_total}
                </td>
                <?php foreach($llll as $key):?>
                  <td>{$total[$mk][$key]}</td>
                <?php endforeach;?>
                {foreach $g as $key=>$value}
                    {foreach $value as $_=>$haha}
                    <td style="text-align: center">{$haha}</td>
                    {/foreach}
                {/foreach}
        </tr>
        {/foreach}
    </tbody>
</table>
<div style="text-align: right"><button id="excel" type="button">下载excel表格</button></div>
<div style="text-align: left">
    <select id="redirect">
        <option data-url="{:url('admin/questionnaire/childrenshow',['id'=>$id,'parent'=>$parent,'children'=>$children])}">显示普通统计</option>
        <option selected data-url="{:url('admin/questionnaire/juzhengshow',['id'=>$id,'parent'=>$parent,'children'=>$children])}">只显示矩阵统计</option>
    </select>
</div>
<script src="__STATIC__/js/table2excel/jquery.2.2.4.js"></script>
<script src="__STATIC__/js/table2excel/jquery.table2excel.min.js"></script>
<script src="__STATIC__/js/table2excel/down.js"></script>
<script>
    $('#redirect').change(function(){
        var _self=$(this);
        var selected=_self.find('option:selected');
        location.href=selected.data('url');
    })
</script>
</body>
</html>